package com.mimiwang.article.controller;

import com.mimiwang.article.entity.ArticlePhotoEntity;
import com.mimiwang.article.service.ArticlePhotoService;
import com.mimiwang.common.utils.PageUtils;
import com.mimiwang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author huangqicai
 * @email 1355518552@qq.com
 * @date 2022-10-07 15:31:26
 */
@RestController
@RequestMapping("member/articlephoto")
public class ArticlePhotoController {
    @Autowired
    private ArticlePhotoService articlePhotoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = articlePhotoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		ArticlePhotoEntity articlePhoto = articlePhotoService.getById(id);

        return R.ok().put("articlePhoto", articlePhoto);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ArticlePhotoEntity articlePhoto){
		articlePhotoService.save(articlePhoto);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ArticlePhotoEntity articlePhoto){
		articlePhotoService.updateById(articlePhoto);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		articlePhotoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
